#ifndef __MK_PTHREAD_H__
#define __MK_PTHREAD_H__

#include "stdbool.h"


#ifdef __cplusplus
extern "C" {
#endif


#ifdef __LINUX_OS__

#include <sys/types.h>
#include <linux/sched.h>

#include <pthread.h>

#include "pthread_param_custom.h"

typedef void* (*pthread_entry)(void*);

extern int mk_pthread_default(pthread_t *ptid,pthread_entry entry,void *arg);

extern int mk_pthread(pthread_t *ptid,pthread_entry entry,void *arg);
extern int mk_pthread_priority(pthread_t *ptid,pthread_entry entry,void *arg,int priority);
extern int mk_pthread_priority_stack(pthread_t *ptid,pthread_entry entry,void *arg,size_t stack_size, int priority);
extern int mk_pthread_priority_stack_detached(pthread_t *ptid,pthread_entry entry,void *arg,
			size_t stack_size, int priority,bool isdetached);
extern int mk_pthread_realtime_default(pthread_t *ptid,pthread_entry entry,void *arg);
extern int mk_pthread_cancel(pthread_t *ptid);

//PTHREAD_CREATE_DETACHED
extern int makethread(pthread_t *ptid,void *(*fn)(void*),void *arg);
#endif
#define THREAD_STACK_128K (128<<10)
#define THREAD_STACK_96K (96<<10)
#define THREAD_STACK_64K (64<<10)
#define THREAD_STACK_48K (48<<10)
#define THREAD_STACK_32K (32<<10)  // 32K
#define THREAD_STACK_16K (16<<10) 
#define THREAD_STACK_8K (8<<10)

#define DEFAULT_THREAD_STACK       THREAD_STACK_32K  

#define USE_DEFAULT_STACK      0   // 0  1
/*
ulimit -a
ulimit -s unlimited           #   ��ջ��С
*/
#ifdef __cplusplus
}
#endif
#endif
